home *** CD-ROM | disk | FTP | other *** search
- Path: news.missouri.edu!MU
- From: c576537@mizzou1.missouri.edu (Chris Vogel)
- Newsgroups: comp.lang.c++
- Subject: dynamic arrays using char with far pointers
- Date: 27 Mar 1996 22:40:21 GMT
- Organization: University of Missouri
- Message-ID: <4jcg4l$18hq@news.missouri.edu>
- NNTP-Posting-Host: mizzou-ts5-05.missouri.edu
- X-Newsreader: News Xpress Version 1.0 Beta #4
-
- I'm converting some code I have out of a book to C++. I'm converting a
- structure to a class(kind of logical :) ). The structure has:
-
- char far *buffer;
-
- Now, I thought that to initialize it, it would be:
-
- buffer = new char[size];
-
- but that gives me a run time error. So, I changed it to:
-
- buffer = new (char far *)[size];
-
- but then, when I read in data and put it in the data I get an even worse run
- time error, because it restarts the computer. I make sure my index is not
- greater than size, but it still kicks me out. Could someone suggest an
- answer. I guess I could always use malloc, but new basically is better. If
- it matters, I'm using Borland C++ 4.5 for DOS.
-
- Thanks in advance,
-
- Chris Vogel
-